import java.io.Serializable;

/**
 * Object to store host/port pairs.
 * 
 * @author James Marqurdt
 */
public class HostPort implements Serializable {
	
	/**
     * 
     */
    private static final long serialVersionUID = -6431480174575036994L;
    /**
	 * The host being stored.
	 */
	private final String host;
	/**
	 * The port being stored.
	 */
	private final int port;
	
	/**
	 * Constructor for a HostPort
	 * @param the_host The host being stored
	 * @param the_port The port being stored
	 */
	public HostPort(String the_host, int the_port) {
		this.host = the_host;
		this.port = the_port;
	}
	
	public String getHost() {
	    return this.host;
	}
	
	public int getPort() {
	    return this.port;
	}

    @Override
    public String toString() {
        return "<" + host + ">:<" + port + ">";
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        HostPort other = (HostPort) obj;
        if (host == null) {
            if (other.host != null)
                return false;
        } else if (!host.equals(other.host))
            return false;
        if (port != other.port)
            return false;
        return true;
    }

}
